<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button class="btn">点我打开页面</button>
    <button class="btn">点我获取地址栏</button>
    <button class="btn">点我刷新</button>
    <button class="btn">点我获取哈希值</button>
    <button class="btn">点我获取哈希值</button>

    <script>
      // document.getElementsByClassName("btn")[0].onclick = function () {
      //   // console.log(123);
      //   // window.open("http://www.baidu.com");
      //   window.open("./a.html");
      // };
      var btn = document.getElementsByClassName("btn");
      btn[1].onclick = function () {
        console.log(window.location.href);
      };
      btn[2].onclick = function () {
        window.location.reload();
      };
      btn[3].onclick = function () {
        console.log(window.location.hash);
      };
    </script>
  </body>
</html>
